<template>
    <div>
        <table>

            <tr>
                <td>编号</td>
                <td>书名</td>
                <td>作者</td>
            </tr>
            <tr v-for="item in books">
                <td>{{item.id}}</td>
                <td>{{item.name}}</td>
                <td>{{item.author}}</td>
            </tr>
        </table>
    </div>
</template>

<script>
    export default {
        name: "Book",
        data() {
            return {
                books: [{
                    id: 1,
                    name: 'java',
                    author: 'A'
                }, {
                    id: 2,
                    name: 'py',
                    author: 'B'
                }, {
                    id: 3,
                    name: 'c++',
                    author: 'C'
                }]
            }
        },
        //初始化操作
        created() {
            const _this = this
            //使用axios请求后台接口        请求方式   then里面回调   resp结果值
            axios.get('http://localhost:8181/book/findAll').then(function (resp) {
                // this.tableData=resp.data.data

                _this.books = resp.data;
            })
        }
    }
</script>

<style scoped>

</style>